import styles from './index.module.less'

function Position({ data }: any) {
    console.log(data?.name)
    const { name, detail = [] } = data || {}
    const lableList = {
        listName: '意向岗位',
        capacity: '求职意向',
        city: '意向城市',
        area: '工作区域',
        salary: '期望薪资（税前）',
        time: '入职时间',
    }

    return (
        <div className={styles.container}>
            <header>{name}</header>
            {detail.length > 0 &&
                detail.map((item: any, index: number) => (
                    <div className={styles.list} key={`${item?.code}${item?.capacityId}`}>
                        <div className={styles.list_title}>
                            <div className={styles.list_icon} />
                            <div className={styles.list_title_text}>
                                {lableList?.listName}
                                {index + 1}
                            </div>
                        </div>
                        <div className={styles.content}>
                            <div className={styles.content_list}>
                                <div>{lableList?.capacity}</div>
                                <div>{item?.capacityName}</div>
                            </div>
                            <div className={styles.content_list}>
                                <div>{lableList?.city}</div>
                                <div>{item?.cityName}</div>
                            </div>
                            <div className={styles.content_list}>
                                <div>{lableList?.area}</div>
                                <div>{item?.workArea}</div>
                            </div>
                            <div className={styles.content_list}>
                                <div>{lableList?.salary}</div>
                                {/* 薪资相等展示一个就行 */}
                                {item?.minSalary === item?.maxSalary && <div>{item?.minSalary / 1000}k</div>}
                                {item?.minSalary !== item?.maxSalary && (
                                    <div>
                                        {item?.minSalary / 1000}k-{item?.maxSalary / 1000}k
                                    </div>
                                )}
                            </div>
                            <div className={styles.content_list}>
                                <div>{lableList?.time}</div>
                                <div>{item?.joinTime}</div>
                            </div>
                        </div>
                    </div>
                ))}
        </div>
    )
}

export default Position
